﻿using System.Collections.Generic;
using System.Linq;
using EDMDesigner.Business.CSDL.Type.Entity;
using EDMDesigner.Business.CSDL.Property.Navigation;

namespace EDMDesigner.UIBusiness.MSL
{
    public class AssociationPropertiesMapping : PropertiesMapping
    {
        public AssociationPropertiesMapping(NavigationProperty navigationProperty, EDMDesigner.Business.SSDL.EntityType.EntityType table)
            :base(navigationProperty.EntityType, table)
        {
            NavigationProperty = navigationProperty;
        }

        public NavigationProperty NavigationProperty { get; private set; }

        public override IEnumerable<PropertyMapping> Mappings
        {
            get 
            {
                return EntityType.Keys.Select(k => new PropertyMapping(k, NavigationProperty.Mapping, Table));
            }
        }
    }
}
